package com.jiang.spring_security_singleboot.mapper;

import com.jiang.spring_security_singleboot.domain.SysRole;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @中软华腾软件系统有限公司,未经授权不得擅自传播
 * @类描述:
 * @类名称:RoleMapper
 * @作者: 蒋正午
 * @编辑时间: 2021/4/26 23:19
 * @版本: 1.0
 */
public interface RoleMapper {

    @Select("SELECT r.id,r.role_name roleName,r.role_desc roleDesc FROM `sys_role` AS r, `sys_user_role` AS ur WHERE r.id = ur.rid AND ur.uid=#{uid}; ")
    List<SysRole> findRoleByUid(Integer uid);

    @Insert("insert into sys_role (role_name, role_desc) values (#{roleName}, #{roleDesc})")
    public void save(SysRole role);

    @Select("select id, role_name roleName, role_desc roleDesc from sys_role")
    public List<SysRole> findAll();


}
